package com.berchen.数据结构.图;

public class GraphTest {
    public static void main(String[] args) {

        String vertexValie[]={"A","B","C","D","E","F","G","H"};
        int n = vertexValie.length;    // 节点个数
        Graph graph = new Graph(n);
        for(String s:vertexValie){
            graph.insertVertex(s);
        }

        graph.insertEdge(0,1,1);    // AB
        graph.insertEdge(0,2,1);    // AC
        graph.insertEdge(1,2,1);    // BC
        graph.insertEdge(1,4,1);    // BE
        graph.insertEdge(1,3,1);    // BD
        graph.insertEdge(0,5,1);    // AF
        graph.insertEdge(4,6,1);    // EG
        graph.insertEdge(3,6,1);    // DG
        graph.insertEdge(1,7,1);    // BH



        graph.showGraph();

        System.out.println("深度");
        graph.depthFirst();
        System.out.println("\n广度");
        graph.breadthFirst();
    }
}
